package com.ease.platform.model.type;

import com.ease.common.enums.EnumUtil;
import com.ease.common.enums.OptionalEnum;

public enum PermissionDimensionType implements OptionalEnum {

	UserDefaultDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.DefaultDimension), //
	UserMenuDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.MenuDimension), //
	UserRightClickMenuDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.RightClickMenuDimension), //
	UserButtonDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.ButtonDimension), //
	UserPerspectiveViewDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.PerspectiveViewDimension), //
	UserExplorerDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.ExplorerDimension), //

	UserLocationDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.LocationDimension), //
	UserNetworkSpecialtyDimension(PermissionDimensionSourceType.User, PermissionDimensionMetaType.NetworkSpecialtyDimension), //

	UserGroupDefaultDimension(PermissionDimensionSourceType.UserGroup, PermissionDimensionMetaType.DefaultDimension), //
	UserGroupLocationDimension(PermissionDimensionSourceType.UserGroup, PermissionDimensionMetaType.LocationDimension), //
	UserGroupNetworkSpecialtyDimension(PermissionDimensionSourceType.UserGroup, PermissionDimensionMetaType.NetworkSpecialtyDimension);//

	private short value;

	private String text;

	private PermissionDimensionType(PermissionDimensionSourceType sourceType, PermissionDimensionMetaType metaType) {
		this.value = (short) (sourceType.getValue() * 10 + metaType.getValue());
		this.text = sourceType.getText() + "的" + metaType.getText();
	}

	private PermissionDimensionType(short value, String text) {
		this.value = value;
		this.text = text;
	}

	public final static PermissionDimensionType get(short value) {
		return EnumUtil.get(PermissionDimensionType.class, value);
	}

	public final static PermissionDimensionType get(String name) {
		return EnumUtil.get(PermissionDimensionType.class, name);
	}

	/**
	 * @return the text
	 */
	public String getText() {
		return text;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name();
	}

	/**
	 * @return the value
	 */
	public short getValue() {
		return value;
	}
}
